
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace GlobalLogistics.DAL
{
	public abstract class _Sponsors : SqlClientEntity
	{
		public _Sponsors()
		{
			this.QuerySource = "Sponsors";
			this.MappingName = "Sponsors";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_SponsorsLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int SponsorID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.SponsorID, SponsorID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_SponsorsLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter SponsorID
			{
				get
				{
					return new SqlParameter("@SponsorID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter EnTitle
			{
				get
				{
					return new SqlParameter("@EnTitle", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter ArTitle
			{
				get
				{
					return new SqlParameter("@ArTitle", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter EnFilePath
			{
				get
				{
					return new SqlParameter("@EnFilePath", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter ArFilePath
			{
				get
				{
					return new SqlParameter("@ArFilePath", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter URL
			{
				get
				{
					return new SqlParameter("@URL", SqlDbType.NVarChar, 300);
				}
			}
			
			public static SqlParameter ViewOrder
			{
				get
				{
					return new SqlParameter("@ViewOrder", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string SponsorID = "SponsorID";
            public const string EnTitle = "EnTitle";
            public const string ArTitle = "ArTitle";
            public const string EnFilePath = "EnFilePath";
            public const string ArFilePath = "ArFilePath";
            public const string URL = "URL";
            public const string ViewOrder = "ViewOrder";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[SponsorID] = _Sponsors.PropertyNames.SponsorID;
					ht[EnTitle] = _Sponsors.PropertyNames.EnTitle;
					ht[ArTitle] = _Sponsors.PropertyNames.ArTitle;
					ht[EnFilePath] = _Sponsors.PropertyNames.EnFilePath;
					ht[ArFilePath] = _Sponsors.PropertyNames.ArFilePath;
					ht[URL] = _Sponsors.PropertyNames.URL;
					ht[ViewOrder] = _Sponsors.PropertyNames.ViewOrder;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string SponsorID = "SponsorID";
            public const string EnTitle = "EnTitle";
            public const string ArTitle = "ArTitle";
            public const string EnFilePath = "EnFilePath";
            public const string ArFilePath = "ArFilePath";
            public const string URL = "URL";
            public const string ViewOrder = "ViewOrder";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[SponsorID] = _Sponsors.ColumnNames.SponsorID;
					ht[EnTitle] = _Sponsors.ColumnNames.EnTitle;
					ht[ArTitle] = _Sponsors.ColumnNames.ArTitle;
					ht[EnFilePath] = _Sponsors.ColumnNames.EnFilePath;
					ht[ArFilePath] = _Sponsors.ColumnNames.ArFilePath;
					ht[URL] = _Sponsors.ColumnNames.URL;
					ht[ViewOrder] = _Sponsors.ColumnNames.ViewOrder;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string SponsorID = "s_SponsorID";
            public const string EnTitle = "s_EnTitle";
            public const string ArTitle = "s_ArTitle";
            public const string EnFilePath = "s_EnFilePath";
            public const string ArFilePath = "s_ArFilePath";
            public const string URL = "s_URL";
            public const string ViewOrder = "s_ViewOrder";

		}
		#endregion		
		
		#region Properties
	
		public virtual int SponsorID
	    {
			get
	        {
				return base.Getint(ColumnNames.SponsorID);
			}
			set
	        {
				base.Setint(ColumnNames.SponsorID, value);
			}
		}

		public virtual string EnTitle
	    {
			get
	        {
				return base.Getstring(ColumnNames.EnTitle);
			}
			set
	        {
				base.Setstring(ColumnNames.EnTitle, value);
			}
		}

		public virtual string ArTitle
	    {
			get
	        {
				return base.Getstring(ColumnNames.ArTitle);
			}
			set
	        {
				base.Setstring(ColumnNames.ArTitle, value);
			}
		}

		public virtual string EnFilePath
	    {
			get
	        {
				return base.Getstring(ColumnNames.EnFilePath);
			}
			set
	        {
				base.Setstring(ColumnNames.EnFilePath, value);
			}
		}

		public virtual string ArFilePath
	    {
			get
	        {
				return base.Getstring(ColumnNames.ArFilePath);
			}
			set
	        {
				base.Setstring(ColumnNames.ArFilePath, value);
			}
		}

		public virtual string URL
	    {
			get
	        {
				return base.Getstring(ColumnNames.URL);
			}
			set
	        {
				base.Setstring(ColumnNames.URL, value);
			}
		}

		public virtual int ViewOrder
	    {
			get
	        {
				return base.Getint(ColumnNames.ViewOrder);
			}
			set
	        {
				base.Setint(ColumnNames.ViewOrder, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_SponsorID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SponsorID) ? string.Empty : base.GetintAsString(ColumnNames.SponsorID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SponsorID);
				else
					this.SponsorID = base.SetintAsString(ColumnNames.SponsorID, value);
			}
		}

		public virtual string s_EnTitle
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EnTitle) ? string.Empty : base.GetstringAsString(ColumnNames.EnTitle);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EnTitle);
				else
					this.EnTitle = base.SetstringAsString(ColumnNames.EnTitle, value);
			}
		}

		public virtual string s_ArTitle
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ArTitle) ? string.Empty : base.GetstringAsString(ColumnNames.ArTitle);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ArTitle);
				else
					this.ArTitle = base.SetstringAsString(ColumnNames.ArTitle, value);
			}
		}

		public virtual string s_EnFilePath
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EnFilePath) ? string.Empty : base.GetstringAsString(ColumnNames.EnFilePath);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EnFilePath);
				else
					this.EnFilePath = base.SetstringAsString(ColumnNames.EnFilePath, value);
			}
		}

		public virtual string s_ArFilePath
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ArFilePath) ? string.Empty : base.GetstringAsString(ColumnNames.ArFilePath);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ArFilePath);
				else
					this.ArFilePath = base.SetstringAsString(ColumnNames.ArFilePath, value);
			}
		}

		public virtual string s_URL
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.URL) ? string.Empty : base.GetstringAsString(ColumnNames.URL);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.URL);
				else
					this.URL = base.SetstringAsString(ColumnNames.URL, value);
			}
		}

		public virtual string s_ViewOrder
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ViewOrder) ? string.Empty : base.GetintAsString(ColumnNames.ViewOrder);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ViewOrder);
				else
					this.ViewOrder = base.SetintAsString(ColumnNames.ViewOrder, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter SponsorID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SponsorID, Parameters.SponsorID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter EnTitle
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EnTitle, Parameters.EnTitle);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ArTitle
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ArTitle, Parameters.ArTitle);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter EnFilePath
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EnFilePath, Parameters.EnFilePath);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ArFilePath
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ArFilePath, Parameters.ArFilePath);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter URL
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.URL, Parameters.URL);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ViewOrder
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ViewOrder, Parameters.ViewOrder);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter SponsorID
		    {
				get
		        {
					if(_SponsorID_W == null)
	        	    {
						_SponsorID_W = TearOff.SponsorID;
					}
					return _SponsorID_W;
				}
			}

			public WhereParameter EnTitle
		    {
				get
		        {
					if(_EnTitle_W == null)
	        	    {
						_EnTitle_W = TearOff.EnTitle;
					}
					return _EnTitle_W;
				}
			}

			public WhereParameter ArTitle
		    {
				get
		        {
					if(_ArTitle_W == null)
	        	    {
						_ArTitle_W = TearOff.ArTitle;
					}
					return _ArTitle_W;
				}
			}

			public WhereParameter EnFilePath
		    {
				get
		        {
					if(_EnFilePath_W == null)
	        	    {
						_EnFilePath_W = TearOff.EnFilePath;
					}
					return _EnFilePath_W;
				}
			}

			public WhereParameter ArFilePath
		    {
				get
		        {
					if(_ArFilePath_W == null)
	        	    {
						_ArFilePath_W = TearOff.ArFilePath;
					}
					return _ArFilePath_W;
				}
			}

			public WhereParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public WhereParameter ViewOrder
		    {
				get
		        {
					if(_ViewOrder_W == null)
	        	    {
						_ViewOrder_W = TearOff.ViewOrder;
					}
					return _ViewOrder_W;
				}
			}

			private WhereParameter _SponsorID_W = null;
			private WhereParameter _EnTitle_W = null;
			private WhereParameter _ArTitle_W = null;
			private WhereParameter _EnFilePath_W = null;
			private WhereParameter _ArFilePath_W = null;
			private WhereParameter _URL_W = null;
			private WhereParameter _ViewOrder_W = null;

			public void WhereClauseReset()
			{
				_SponsorID_W = null;
				_EnTitle_W = null;
				_ArTitle_W = null;
				_EnFilePath_W = null;
				_ArFilePath_W = null;
				_URL_W = null;
				_ViewOrder_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter SponsorID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SponsorID, Parameters.SponsorID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter EnTitle
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EnTitle, Parameters.EnTitle);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ArTitle
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ArTitle, Parameters.ArTitle);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter EnFilePath
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EnFilePath, Parameters.EnFilePath);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ArFilePath
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ArFilePath, Parameters.ArFilePath);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter URL
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.URL, Parameters.URL);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ViewOrder
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ViewOrder, Parameters.ViewOrder);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter SponsorID
		    {
				get
		        {
					if(_SponsorID_W == null)
	        	    {
						_SponsorID_W = TearOff.SponsorID;
					}
					return _SponsorID_W;
				}
			}

			public AggregateParameter EnTitle
		    {
				get
		        {
					if(_EnTitle_W == null)
	        	    {
						_EnTitle_W = TearOff.EnTitle;
					}
					return _EnTitle_W;
				}
			}

			public AggregateParameter ArTitle
		    {
				get
		        {
					if(_ArTitle_W == null)
	        	    {
						_ArTitle_W = TearOff.ArTitle;
					}
					return _ArTitle_W;
				}
			}

			public AggregateParameter EnFilePath
		    {
				get
		        {
					if(_EnFilePath_W == null)
	        	    {
						_EnFilePath_W = TearOff.EnFilePath;
					}
					return _EnFilePath_W;
				}
			}

			public AggregateParameter ArFilePath
		    {
				get
		        {
					if(_ArFilePath_W == null)
	        	    {
						_ArFilePath_W = TearOff.ArFilePath;
					}
					return _ArFilePath_W;
				}
			}

			public AggregateParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public AggregateParameter ViewOrder
		    {
				get
		        {
					if(_ViewOrder_W == null)
	        	    {
						_ViewOrder_W = TearOff.ViewOrder;
					}
					return _ViewOrder_W;
				}
			}

			private AggregateParameter _SponsorID_W = null;
			private AggregateParameter _EnTitle_W = null;
			private AggregateParameter _ArTitle_W = null;
			private AggregateParameter _EnFilePath_W = null;
			private AggregateParameter _ArFilePath_W = null;
			private AggregateParameter _URL_W = null;
			private AggregateParameter _ViewOrder_W = null;

			public void AggregateClauseReset()
			{
				_SponsorID_W = null;
				_EnTitle_W = null;
				_ArTitle_W = null;
				_EnFilePath_W = null;
				_ArFilePath_W = null;
				_URL_W = null;
				_ViewOrder_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SponsorsInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.SponsorID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SponsorsUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SponsorsDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.SponsorID);
			p.SourceColumn = ColumnNames.SponsorID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.SponsorID);
			p.SourceColumn = ColumnNames.SponsorID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.EnTitle);
			p.SourceColumn = ColumnNames.EnTitle;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ArTitle);
			p.SourceColumn = ColumnNames.ArTitle;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.EnFilePath);
			p.SourceColumn = ColumnNames.EnFilePath;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ArFilePath);
			p.SourceColumn = ColumnNames.ArFilePath;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.URL);
			p.SourceColumn = ColumnNames.URL;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ViewOrder);
			p.SourceColumn = ColumnNames.ViewOrder;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
